package lv.accenture.bootcamp;


public class primes {
	public static void main(String[] args) {
		if (args.length < 1) {
			System.err.println("Give one number as command-line argument");
			System.exit(0);
		}
		int nValues = Integer.parseInt(args[0]);

		for (int number = 2; number <= nValues; number++) {

			int nDevMax = (int) Math.sqrt(number)+1;
			boolean isPrime = true;

			for (int nDevider = 2; nDevider < nDevMax; nDevider++) {				
				if (number % nDevider == 0) {
					isPrime = false;
					break;
				}
			}
			if (isPrime) {
				System.out.println("Number " + number + " is prime.");
			} else {
				System.out.println("Number " + number + " is not prime.");
			}
		}
	}
}
